Señales

Tabla de contenido

Señales

t = -1:1:3;
f = @(t) t.^2;
t
t = 1×5
-1 0 1 2 3
f(t)
ans = 1×5
1 0 1 4 9
plot(t,f(t))
t = -1:0.01:3;
plot(t,f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t)=t^2')
n = -1:1:5;
g = @(n) n.^2;
stem(n,g(n),'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(n)=n^2 ')

Señal real y señal compleja

t = -3:0.01:3;
plot(t,t.^3, 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal real f(t)=t^3 ')
t=-100:0.1:100;
plot3(t,t.^2,t,'LineWidth',2)
grid on
xlabel('Dominio t')
ylabel('Re')
zlabel('Im')
title('Gráfica de la señal f(t)=t^2+tj ')

Señal causal

t = linspace(-3,5,200);
f = @(t) exp(-t);
plot(t,f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t)=e^{-t} ')
syms t
y = piecewise(t < 0,0,t >= 0,exp(-t))
y = 
fplot(y,[-3 5], 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal causal f(t)')

Traslación horizontal y vertical

t = -3:0.01:5;
f = @(t) t.^2;
subplot(2,2,1)
t = -5:0.01:3; % ajuste de t
plot(t,f(t+2), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t+2)')
subplot(2,2,2)
plot(t,f(t)+2, 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t)+2')
subplot(2,2,3)
t = 0:0.01:8; % ajuste de t
plot(t,f(t-3), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t-3)')
subplot(2,2,4)
plot(t,f(t)-1, 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t)-1')

Escalamiento horizontal

t = 0:0.01:pi;
f = @(t) sin(t);
figure
subplot(3,2,1)
plot(t,f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -0.2 1.2])% ajuste visualización
title('Gráfica de la señal f(t)')
subplot(3,2,2)
t = -pi:0.01:0; % ajuste t
plot(t,f(-t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -0.2 1.2])% ajuste visualización
title('Gráfica de la señal f(-t)')
subplot(3,2,3)
t = 0:0.01:pi/2; % ajuste t
plot(t,f(2*t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -0.2 1.2])% ajuste visualización
title('Gráfica de la señal f(2t)')
subplot(3,2,4)
t = -pi/2:0.01:0; % ajuste t
plot(t,f(-2*t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -0.2 1.2])% ajuste visualización
title('Gráfica de la señal f(-2t)')
subplot(3,2,5)
t = 0:0.01:3*pi; % ajuste t
plot(t,f((1/3)*t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-10 10 -0.2 1.2])% ajuste visualización
title('Gráfica de la señal f((1/3)t)')
subplot(3,2,6)
t = -3*pi:0.01:0; % ajuste t
plot(t,f((-1/3)*t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-10 10 -0.2 1.2]) % ajuste visualización
title('Gráfica de la señal f((-1/3)*t)')

Escalamiento vertical

t = -pi:0.01:pi;
f = @(t) sin(t);
figure
subplot(3,2,1)
plot(t,f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal f(t)')
subplot(3,2,2)
plot(t,-2*f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal -2f(t)')
subplot(3,2,3)
plot(t,2*f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal 2f(t)')
subplot(3,2,4)
plot(t,(-1/3)*f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal (-1/3)f(t)')
subplot(3,2,5)
plot(t,(1/3)*f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal (1/3)f(t)')
subplot(3,2,6)
plot(t,-f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -2.2 2.2])% ajuste visualización
title('Gráfica de la señal -f(t)')

Orden de las operaciones

Si se quiere profundizar en el tema se pueden consultar los video R01 de la siguiente página
En el siguiente enlace se encuentras algunas notas

Operaciones aritméticas

Señales pares e impares

syms t g(t) f(t)
g(t) = abs(t)*exp(-abs(t))
g(t) = 
g(-t)
ans = 
disp('g es par')
g es par
h(t)= t^3*cos(t)
h(t) = 
h(-t)
ans = 
disp('h es impar')
h es impar
f(t) = cos(t)+sin(3*t)-1
f(t) = 
f(-t)
ans = 
disp('f no es impar ni par')
f no es impar ni par
f_p(t) = (f(t) + f(-t))/2
f_p(t) = 
f_p(-t)
ans = 
f_i(t) = (f(t) - f(-t))/2
f_i(t) = 
f_i(-t)
ans = 
figure
subplot(3,1,1)
fplot(f_p(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f_p(t)')
subplot(3,1,2)
fplot(f_i(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f_i(t)')
subplot(3,1,3)
fplot(f(t), 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal f(t)')

Actividad

Escalón unitario (heaviside)

clear vars
syms t f(t)
u(t) = heaviside(t);
u(-1)
ans = 
0
u(3.4)
ans = 
1
u(0)
ans = 
1
figure
fplot(u(t),[-2,3])
axis([-3 5 -0.2 1.2])
f(t) = exp(-t)
f(t) = 
figure
fplot(f,[-2,5])
g(t) = f(t)*u(t)
g(t) = 
hold on
fplot(g(t),[-3 5], 'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la señal causal g(t)')
hold off
f(t) = u(t+1) - u(t-1) - 2 * u(t);
fplot(f(t),[-1.5 1.5], 'LineWidth',2)
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-2 2 -1.2 1.2])
title('Gráfica de la señal causal g(t)')

Delta de Dirac

En el siguiente desmos están las implementaciones
clear vars
syms t
d(t) = dirac(t)
d(t) = 
d(6)
ans = 
0
d(-7.4)
ans = 
0
d(0) % cuidado con las convenciones
ans = 
int(d(t),t,-inf, inf)
ans = 
1
f(t) = cos((pi/2)*t);
int(f(t)*d(2*t-3),t,-inf,inf)
ans = 

Funciones exponenciales complejas de variable real

t=0:0.01:10;
sigma=-0.5;
omega=10;
s=sigma+omega*1j;
f=exp(s*t);
figure
plot3(t,real(f),imag(f),'LineWidth',2)
grid on
xlabel('Dominio t')
ylabel('Re')
zlabel('Im')
title('Gráfica de la señal f(t)=e^{st} ')
figure
subplot(2,2,1)
plot(real(f),imag(f))
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
grid on
%xlabel('Dominio n')
title('Parte imaginaria y parte real')
subplot(2,2,3)
plot(t,real(f))
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
grid on
%xlabel('Dominio n')
title('tiempo y parte real')
subplot(2,2,4)
plot(t,imag(f))
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
grid on
%xlabel('Dominio n')
title('tiempo y parte imaginaria')
Si se quiere profundizar en el tema se pueden consultar los video R02 de la siguiente página
En el siguiente enlace se encuentras algunas notas

Convolución de señales

clear vars
syms t tau f(t)
u(t) = heaviside(t);
f(t) = exp(-t)*u(t)-exp(t)*u(-t);
g(t)=int(f(tau)*u(t-tau),tau,-inf,inf)
g(t) = 
figure
fplot(g,[-5,5],'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
axis([-5 5 -1.1 0.2])
title('Gráfica de la convolución')
clear vars
syms t tau f(t)
u(t) = heaviside(t);
x(t) = (t + 1) * u(t + 1) - 2 * t * u(t) - (-t + 1) * u(t-1);
f(t) = 2 * (u(t + 1) - u(t-3));
g(t)=int(f(tau)*x(t-tau),tau,-inf,inf)
g(t) = 
figure
fplot(g,[-3,5],'LineWidth',2)
grid on
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.Box = 'off';
title('Gráfica de la convolución')
clear vars
syms t lambda tau
f(t) = exp(lambda*t)*heaviside(t);
x(t) = u(t);
h(t) = int(f(tau)*x(t-tau),tau,0,t)*heaviside(t)
h(t) = 
assume(t,'positive')
h(t) = int(f(tau)*x(t-tau),tau,0,t)*heaviside(t)
h(t) = 
assume(t,'clear')
h(t)= h(t)*heaviside(t)
h(t) = 
h = subs(h,lambda, -1)
h(t) = 
fplot(h,[-2,10])

Actividad

Si se quiere profundizar en el tema se pueden consultar los videos R08 de la siguiente página
En el siguiente enlace se encuentras algunas notas

Notas Laplace

Ejemplo 1

Encontrar la TL de
clearvars
syms a t s
x(t,a) = exp(-a*t)*heaviside(t)
x(t, a) = 
X(s,a) = laplace(x(t,a))
X(s, a) = 
Falta especificar la región de converhencia que se encuentra con el procedimeinto análitico.
X_1(s,a)=int(x(t,a)*exp(-s*t),t,0,inf)
X_1(s, a) = 
assume(a,'real')
assumeAlso(real(s) + real(a) > 0)
X_1(s,a)=int(x(t,a)*exp(-s*t),t,0,inf)
X_1(s, a) = 
fplot(x(t,2))
syms rs is real
s = rs + j*is
s = 
X(rs,is,a)=X(s,a)
X(rs, is, a) = 
fmesh(abs(X(rs,is,2)),[-1.5 1.5 -2.5 -1.5])

Ejemplo 2

Encontrar la derivada de la delta de Dirac y del escalón unitario (Heaviside)
clearvars
syms t s
x_a(t) = dirac(t)
x_a(t) = 
X_a(s) = laplace(x_a(t))
X_a(s) = 
1
int(x_a(t)*exp(-s*t),t,0,inf)
ans = 
1
x_b(t) = heaviside(t)
x_b(t) = 
X_b(s) = laplace(x_b(t))
X_b(s) = 
int(x_b(t)*exp(-s*t),t,0,inf)
ans = 
assume(real(s)>0)
int(x_b(t)*exp(-s*t),t,0,inf)
ans = 

Ejemplo 3

Encontrar la transformada inversa de y
clearvars
syms t s
X_a(s) = (7*s-6)/(s^2-s-6)
X_a(s) = 
partfrac(X_a(s))
ans = 
x_a(t) = ilaplace(X_a(s))
x_a(t) = 
fplot(x_a(t)*heaviside(t)) % pensamos en funciones causales
X_d(s) = (8*s+10)/((s+1)*(s+2)^3)
X_d(s) = 
partfrac(X_d(s))
ans = 
x_d(t) = ilaplace(X_d(s))
x_d(t) = 
fplot(x_d(t)*heaviside(t) )

Ejemplo 4

Encuentra la TL de
syms a b t;
x_a = sin(a*t)* heaviside(t) + cos(b * t) * heaviside(t)
x_a = 
X_a = laplace(x_a)
X_a = 
X_a = collect(X_a)
X_a = 

Ejemplo 5

Encontrar la TL de la gráfica
clearvars
syms t s
u(t) = heaviside(t)
u(t) = 
x(t)=(t-1)*[u(t-1)-u(t-2)]+[u(t-2)-u(t-4)]
x(t) = 
fplot(x(t), [-2,7])
X(s) = laplace(x(t))
X(s) = 
simplify(X(s))
ans = 

Ejemplo 6

syms t s
X(s) = (s+3+5*exp(-2*s))/((s+1)*(s+2))
X(s) = 
x(t) = ilaplace(X(s))
x(t) = 

Ejemplo 7

syms s t
syms b a real
x(t) = exp(-a*t)*cos(b*t)*heaviside(t)
x(t) = 
X(s) = laplace(x(t))
X(s) = 

Ejemplo 8

syms s t tau
syms a b real
x(t) = exp(a*t)*heaviside(t);
g(t) = exp(b*t)*heaviside(t);
C(s) = laplace(x(t))*laplace(g(t))
C(s) = 
c(t) = ilaplace(C(s))
c(t) = 
simplify(c(t))
ans = 
c1(t) = int(exp(a*tau)*exp(b*(t-tau)),tau, 0,t)
c1(t) = 

Ejemplo 9

syms s t
Y(s) = (10*(2*s+3))/(s*(s^2+2*s+5))
Y(s) = 
y_0=limit(s*Y(s),s,inf)
y_0 = 
0
y_i = limit(s*Y(s),s,0)
y_i = 
6
y(t)= ilaplace(Y(s))
y(t) = 
y(0)
ans = 
0
limit(y(t),t,inf)
ans = 
6
fplot(y(t)*heaviside(t),[-1,10])

Ejemplo 10

Resolver la ecuación diferencial
Si , ,
clearvars
syms s t y(t) x(t) Y(s) X(s) yy
Li= diff(y(t),t,2)+ 5* diff(y(t),t) + 6*y(t)
Li = 
Ld = diff(x(t),t)+x(t)
Ld = 
ecu = Li == Ld
ecu = 
LI = laplace(Li)
LI = 
LI = subs(LI,[laplace(y(t), t, s), y(0),subs(diff(y(t), t), t, 0)],[Y(s),2,1])
LI = 
LD = laplace(Ld)
LD = 
LD = subs(LD,[laplace(x(t), t, s),x(0)],[X(s),0])
LD = 
ecu = LI==LD
ecu = 
ecu = subs(ecu,X(s),laplace(exp(-4*t)*heaviside(t)))
ecu = 
ecu=subs(ecu,Y(s),yy);
Y(s)=simplify(solve(ecu,yy))
Y(s) = 
Y(s)= partfrac(Y(s))
Y(s) = 
y(t) = ilaplace(Y(s))*heaviside(t)
y(t) = 
fplot(y(t),[-1,5])

Ejemplo 11

Resuelve la siguiente ecuación diferencial
syms t
laplace2016a([10 7 1],[1],[0,0],heaviside(t),10)
APLICAMOS TRANSFORMADA DE LAPLACE y subtituimos condiciones iniciales 2 10 Y(s) + 7 s Y(s) + s Y(s) = X(s) SUBSTITUIMOS LA TRANSFORMADA DE LA ENTRADA 2 10 Y(s) + 7 s Y(s) + s Y(s) = 1 - s DESPEJAMOS Y(s) Y(s)= 1 ----------------- 2 s (s + 7 s + 10) DESARROLLAMOS LAS FRACCIONES PARCIALES DE Y(s) Y(s)= 1 1 1 ---------- - --------- + ---- 15 (s + 5) 6 (s + 2) 10 s Aplicamos transformada inversa, asi la solución es y(t)= exp(-5 t) exp(-2 t) 1 --------- - --------- + -- 15 6 10

Actividad

Si se quiere profundizar en el tema, se pueden consultar los videos de R24 y R25 de la siguiente página
En el siguiente enlace se encuentras las notas
function laplace2016a(a,b,ciy,xi,t0)
% a coeficientes de las derivadas de la salida menor a mayor [a_0, ..., a_n]
% b coeficientes de las derivadas de la entrada menor a mayor [b_0, ..., b_m]
% ciy condiciones iniciales de la salida de menor a mayor [y(0), y(0)^(n-1)]
% xi función de entrada en terminos de la variable simbolica t previamente
% declarada en el command window
% t0 tiempo final para graficar la solucion, la derivada, y la segunda
% derivada
% ejemplo: resolver y^(3)+y^(2)+2y^(1)+2y=3x^(2)-x^(1)+2x con y^(2)(0)=1 y^(1)=3
% y(0)=2, x(t)=exp(-t)cos(t)u(t), para 10 segundos, se resuleve como
% syms t
% laplace2016a([2 2 1 1],[2 -1 3],[2 3 1],exp(-t)*cos(t)*heaviside(t),10)
close all
tam=size(a);
tami=size(b);
syms y(t) Y(s) x(t) X(s) Yy fp;
syms edd edi
edd=0;
edi=0;
for i=1:tam(2)
edd=edd+a(i)*s^(i-1)*Y(s);
for k=1:i-1
edd=edd-a(i)*(s^(i-1-k)*ciy(k));
end
end
for i=1:tami(2)
edi=edi+b(i)*s^(i-1)*X(s);
%for k=1:i-1
% edi=edi-b(i)*(s^(i-1-k)*cix(k));
%end
end
mensaje('APLICAMOS TRANSFORMADA DE LAPLACE y subtituimos condiciones iniciales')
pretty(edd)
disp('=')
pretty(edi)
mensaje('SUBSTITUIMOS LA TRANSFORMADA DE LA ENTRADA')
edi=subs(edi,X(s), laplace(xi));
pretty(edd)
disp('=')
pretty(edi)
mensaje('DESPEJAMOS Y(s)')
edd=collect(edd,Y(s));
edd=subs(edd,Y(s),Yy);
eq1=edd==edi;
disp('Y(s)=')
edd=solve(eq1, Yy);
pretty(simplify(edd))
%%% Para versiones superiores a 2016
mensaje('DESARROLLAMOS LAS FRACCIONES PARCIALES DE Y(s)')
disp('Y(s)=')
pretty(partfrac(edd))
%%%% Si se ejecuta en 2015 o menor comentar las 3 lineas anteriores
mensaje('Aplicamos transformada inversa, asi la solución es')
disp('y(t)=')
y(t)=ilaplace(edd);
pretty(y(t))
dy(t)=diff(y,t);
ddy(t)=diff(dy,t);
figure (1)
hFig = figure(1);
set(hFig, 'Position', [0 0 900 900])
axes1 = axes('Parent',hFig,'FontWeight','bold','FontSize',16);
tiempo=0:0.01:t0;
subplot(2,1,1)
fplot(xi,[0, t0],'b','LineWidth',2)
hold on
fplot(y,[0,t0],'r','LineWidth',2)
legend('Entrada x(t)','Salida y(t)','Location','Best')
xlabel('tiempo','FontWeight','bold','FontSize',16)
title('Entrada y Respuesta del sistema','FontWeight','bold','FontSize',16)
grid on
subplot(2,1,2)
fplot(dy,[0,t0],'g','LineWidth',2)
hold on
title('Primera y segunda derivada de la salida','FontWeight','bold','FontSize',16)
fplot(ddy,[0,t0],'m','LineWidth',2)
legend('dy(t)/dt','d^2y(t)/d^2t','Location','Best')
xlabel('tiempo','FontWeight','bold','FontSize',16)
grid on
end
function mensaje(texto)
disp( ' ')
disp(texto)
disp( ' ')
end